By default, native code libraries are stripped in release builds of your app. This stripping consists of removing the symbol table and debugging information contained in any native libraries used by your app. Stripping native code libraries results in significant size savings; however, it's impossible to diagnose crashes on the Google Play Console due to the missing information (such as class and function names). To debug crashes, you must include a debug symbols file with your app in Play Console.
Upload a symbols file
The Google Play Console reports native crashes under Android vitals. With a few steps, you can generate and upload a native debug symbols file for your app. This file enables symbolicated native crash stack traces (that include class and function names) in Android vitals to help you debug your app in production. These steps vary depending on the version of the Android Gradle plugin used in your project and whether you're using an Android App Bundle (recommended) or APK.
Android Gradle plugin version 4.1 or later
If your project builds an Android App Bundle (AAB), you can configure your build
to automatically include the native debug symbols file in the AAB so it's
uploaded to the Play Console when you publish your app. To include this file in
release builds, add the following to your app's build.gradle.kts
file:
android.buildTypes.release.ndk.debugSymbolLevel = { SYMBOL_TABLE | FULL }
Select the debug symbol level from the following:
- Use
SYMBOL_TABLE
to get function names in the Play Console's symbolicated stack traces. This level supports tombstones. - Use
FULL
to get function names, files, and line numbers in the Play Console's symbolicated stack traces.
If your project builds an APK, use the
android.buildTypes.release.ndk.debugSymbolLevel
setting shown earlier to
generate the native debug symbols file separately. Manually upload the native
debug symbols
file
to the Google Play Console (the process is similar to uploading a mapping file
to deobfuscate stack traces).
As part of the build process, the Android Gradle plugin outputs this file in the
following project location:
app/build/outputs/native-debug-symbols/<var>variant-name</var>/native-debug-symbols.zip
Android Gradle plugin version 4.0 or earlier (and other build systems)
As part of the build process, the Android Gradle plugin keeps a copy of the unstripped libraries in a project directory. This directory structure is similar to the following:
app/build/intermediates/cmake/universal/release/obj/
├── armeabi-v7a/
│ ├── libgameengine.so
│ ├── libothercode.so
│ └── libvideocodec.so
├── arm64-v8a/
│ ├── libgameengine.so
│ ├── libothercode.so
│ └── libvideocodec.so
├── x86/
│ ├── libgameengine.so
│ ├── libothercode.so
│ └── libvideocodec.so
└── x86_64/
├── libgameengine.so
├── libothercode.so
└── libvideocodec.so
Zip up the contents of this directory:
cd app/build/intermediates/cmake/universal/release/obj zip -r symbols.zip .
Manually upload the
symbols.zip
file to the Google Play Console.